package com.carepad.dao;

import com.carepad.entity.Users;
import com.carepad.entity.UsersExample;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

public interface UsersMapper {

	int countByExample(UsersExample example);

	int deleteByExample(UsersExample example);

	int deleteByPrimaryKey(Integer uid);

	int insert(Users record);

	int insertSelective(Users record);

	List<Users> selectByExample(UsersExample example);

	Users selectByPrimaryKey(Integer uid);

	int updateByExampleSelective(@Param("record") Users record,	@Param("example") UsersExample example);

	int updateByExample(@Param("record") Users record, @Param("example") UsersExample example);

	int updateByPrimaryKeySelective(Users record);

	int updateByPrimaryKey(Users record);


@Select("SELECT * FROM tbl_users WHERE ACCOUNT = #{username} AND PASSWORD=#{password}")
	@ResultMap(value="LoginResultMap")
	List<Users> findByUsernameAndPassword(
			@Param("username") String username,
			@Param("password") String password);

@Select("SELECT * FROM tbl_users WHERE EMAIL = #{email}")
	@ResultMap(value="EmailResultMap")
	List<Users> findByEmailAddress(@Param("email") String email);

}

